package com.practice.math;

public class ReverseNumber {
	public int reverse(int n) {
		return n>=0? reversePositive(n) : -reversePositive(-n);
	}
	
	private int reversePositive(int n) {
		return Integer.parseInt(new StringBuilder("" + n).reverse().toString());
	}
	
	private int reversePositive2(int n) {
		int s = 0;
		while (n > 0) {
			s = s * 10 + n%10;
			n = n / 10;
		}
		return s;
	}
}
